package it.polito.connectedcar.vehicle.network;

import it.polito.connectedcar.tcc.zone.Token;

import java.nio.ByteBuffer;

/**
 * Vehicle identification information to be used to authenticate the vehicle
 * 
 * @author Nicola Aresta
 * 
 */
public class VehicleIdentificationToken implements Token {

	private byte[] bluetoothIDNumber;
	private byte[] phoneNumber;

	@Override
	public byte[] getBytes() {
		ByteBuffer bb = ByteBuffer.allocate(bluetoothIDNumber.length+ phoneNumber.length);
		bb.put(bluetoothIDNumber);
		bb.put(phoneNumber);
		return bb.array();
	}

	public VehicleIdentificationToken(String phoneNumber, byte[] bluetoothID) {
		this.phoneNumber = phoneNumber.getBytes();
		this.bluetoothIDNumber = bluetoothID;
	}
}
